/*     */ package com.lmpop.trade.ti_collect;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.RandomID;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ 
/*     */ public class Ti_collectInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_collectInfo()
/*     */   {
/*  15 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  24 */     RandomID randomID = new RandomID();
/*  25 */     String trade_id = randomID.GenTradeId();
/*  26 */     Ti_collect ti_collect = new Ti_collect();
/*  27 */     ti_collect.setTrade_id(trade_id);
/*  28 */     ti_collect.setCust_id(map.getString("cust_id"));
/*  29 */     ti_collect.setInfo_id(map.getString("info_id"));
/*  30 */     ti_collect.setTitle(map.getString("title"));
/*  31 */     ti_collect.setInfo_url(map.getString("info_url"));
/*  32 */     ti_collect.setInfo_type(map.getString("info_type"));
/*  33 */     ti_collect.setIn_date(map.getString("in_date"));
/*  34 */     ti_collect.setUser_id(map.getString("user_id"));
/*     */ 
/*  36 */     String result_code = "0";
/*     */     try {
/*  38 */       insert(dbmMgr, ti_collect);
/*     */     } catch (ApplicationException e) {
/*  40 */       e.printStackTrace();
/*  41 */       result_code = "1";
/*     */     }
/*  43 */     map.setString("result_code", result_code);
/*  44 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_collect ti_collect)
/*     */     throws ApplicationException
/*     */   {
/*  53 */     dbmMgr.update("insertTi_collect", ti_collect);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  63 */     String pkid_string = map.getString("pkid");
/*  64 */     String result_code = "0";
/*     */     try {
/*  66 */       if (!pkid_string.equals("")) {
/*  67 */         String[] pkStr = pkid_string.split("\\|");
/*  68 */         for (int i = 0; i < pkStr.length; i++) {
/*  69 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  73 */       e.printStackTrace();
/*  74 */       result_code = "1";
/*     */     }
/*  76 */     map.setString("result_code", result_code);
/*  77 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  86 */     dbmMgr.update("deleteTi_collect", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  95 */     Ti_collect ti_collect = new Ti_collect();
/*  96 */     ti_collect.setTrade_id(map.getString("trade_id"));
/*  97 */     ti_collect.setCust_id(map.getString("cust_id"));
/*  98 */     ti_collect.setTitle(map.getString("title"));
/*  99 */     ti_collect.setInfo_url(map.getString("info_url"));
/* 100 */     ti_collect.setInfo_type(map.getString("info_type"));
/* 101 */     ti_collect.setIn_date(map.getString("in_date"));
/* 102 */     ti_collect.setUser_id(map.getString("user_id"));
/*     */ 
/* 104 */     String result_code = "0";
/*     */     try {
/* 106 */       update(dbmMgr, ti_collect);
/*     */     } catch (ApplicationException e) {
/* 108 */       e.printStackTrace();
/* 109 */       result_code = "1";
/*     */     }
/* 111 */     map.setString("result_code", result_code);
/* 112 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_collect ti_collect)
/*     */     throws ApplicationException
/*     */   {
/* 121 */     dbmMgr.update("updateTi_collect", ti_collect);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 131 */     Hashtable ti_collect = (Hashtable)obj;
/* 132 */     if (start == 0)
/* 133 */       start = 0;
/*     */     else {
/* 135 */       start = (start - 1) * limit;
/*     */     }
/* 137 */     ti_collect.put("start", Integer.valueOf(start));
/* 138 */     ti_collect.put("limit", Integer.valueOf(limit));
/* 139 */     return this.queryList.getList("getListByTi_collectPage", ti_collect);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 150 */     Hashtable ti_collect = (Hashtable)obj;
/* 151 */     List list = this.queryList.getList("getCountByObjTi_collect", ti_collect);
/* 152 */     int count = 0;
/* 153 */     if ((list != null) && (list.size() > 0)) {
/* 154 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 155 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 156 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 159 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 169 */     return this.queryList.getList("getTi_collectByPk", pk);
/*     */   }
/*     */ 
/*     */   public int ifSameCollect(String user_id, String info_id) {
/* 173 */     Ti_collect ti_collect = new Ti_collect();
/* 174 */     ti_collect.setUser_id(user_id);
/* 175 */     ti_collect.setInfo_id(info_id);
/* 176 */     List list = this.queryList.getList("ifSame_Collect", ti_collect);
/*     */ 
/* 178 */     if ((list != null) && (list.size() > 0)) {
/* 179 */       return 1;
/*     */     }
/* 181 */     return 0;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_collect.Ti_collectInfo
 * JD-Core Version:    0.6.0
 */